package com.zmht.specedu.vo;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import com.zmht.specedu.frame.util.DateTimeUtil;

/**
 * Bjclass entity.
 * 
 * @author MyEclipse Persistence Tools
 */

public class Bjclass implements java.io.Serializable {

    // Fields

    private Integer classId;
    private Grade grades;
    private Integer classType;
    private Integer term;
    private String classNumber;
    private Date addtime;
    private Set<Teacher> teachers = new HashSet<Teacher>(0);
    private Set students = new HashSet(0);
    private Integer grade;

    private String teacherstr = "";
    private String gradeAndClassNumber;
    private Bjclasstype bjclasstype;

    // Constructors

    public String getTeacherstr() {
	teacherstr = "";
	int i=0;
	for (Teacher t : teachers) {
	    if(i++ >0){
		teacherstr += "，"+t.getTname();
	    }else{
		teacherstr += t.getTname();
	    }
	}
	return teacherstr;
    }

    public Bjclass(Integer classId, Grade grades, Integer term,
	    String classNumber, Date addtime, Bjclasstype bjclasstype) {
	super();
	this.classId = classId;
	this.grades = grades;
	this.term = term;
	this.classNumber = classNumber;
	this.addtime = addtime;
	this.bjclasstype = bjclasstype;
    }

    public Bjclass(Integer classId, Integer classType, Integer term,
	    String classNumber, Date addtime, Integer grade) {
	super();
	this.classId = classId;
	this.classType = classType;
	this.term = term;
	this.classNumber = classNumber;
	this.addtime = addtime;
	this.grade = grade;
    }

    /** default constructor */
    public Bjclass() {
    }

    /** minimal constructor */
    public Bjclass(Integer classId, Grade grades, Integer classType,
	    Bjclasstype bjclasstype) {
	this.classId = classId;
	this.classType = classType;
	this.grades = grades;
	this.bjclasstype = bjclasstype;
	// this.classNumber=classNumber;
    }

    /** full constructor */
    public Bjclass(Integer classId, Grade grades, Integer classType,
	    Integer term, Integer grade, String classNumber, Set classteachers,
	    Set students, Bjclasstype bjclasstype) {
	this.classId = classId;
	this.grades = grades;
	this.classType = classType;
	this.term = term;
	this.grade = grade;
	this.classNumber = classNumber;
	this.teachers = classteachers;
	this.students = students;
	this.bjclasstype = bjclasstype;
    }

    // Property accessors

    public Integer getClassId() {
	return this.classId;
    }

    public void setClassId(Integer classId) {
	this.classId = classId;
    }

    public Integer getClassType() {
	return this.classType;
    }

    public void setClassType(Integer classType) {
	this.classType = classType;
    }

    public Integer getTerm() {
	return this.term;
    }

    public void setTerm(Integer term) {
	this.term = term;
    }

    public String getClassNumber() {
	return this.classNumber;
    }

    public void setClassNumber(String classNumber) {
	this.classNumber = classNumber;
    }

    public Set getTeachers() {
	return this.teachers;
    }

    public void setTeachers(Set teachers) {
	this.teachers = teachers;
    }

    public Set getStudents() {
	return this.students;
    }

    public void setStudents(Set students) {
	this.students = students;
    }

    public void setTeacherstr(String teacherstr) {
	this.teacherstr = teacherstr;
    }

    public Date getAddtime() {
	return this.addtime;

    }

    public String getAddtime1() {
	/*
	 * SimpleDateFormat s=new SimpleDateFormat("yyyy��mm��dd��"); String
	 * time2=""; String tem=addtime.substring(0,10); try{ String pattern =
	 * "yyyy-MM-dd HH:mm:ss"; }catch(Exception e){ e.printStackTrace(); }
	 * addtime=tem;
	 */
	return DateTimeUtil.shortFmt(this.addtime, "yyyy-MM-dd");

    }

    public void setAddtime(Date addtime) {
	this.addtime = addtime;
    }

    public String getGradeAndClassNumber() {
	return grades.getName() + getClassNumber()+ "班";
    }

    public void setGradeAndClassNumber(String gradeAndClassNumber) {
	this.gradeAndClassNumber = gradeAndClassNumber;
    }

    public Grade getGrades() {
	return grades;
    }

    public void setGrades(Grade grades) {
	this.grades = grades;
    }

    public Integer getGrade() {
	return grade;
    }

    public void setGrade(Integer grade) {
	this.grade = grade;
    }

    public Bjclasstype getBjclasstype() {
	return bjclasstype;
    }

    public void setBjclasstype(Bjclasstype bjclasstype) {
	this.bjclasstype = bjclasstype;
    }

}